﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Services;
using System.Reflection;
using ADONETDataServicesExtension.Utils;
using ADONETDataServicesExtension.Providers;
using System.Collections;

namespace ADONETDataServicesExtension
{
    public static class WebUtil
    {
        internal const string FrameworkTypeName = "System.Data.Services.WebUtil";

        public static bool IsCatchableExceptionType(this Exception e)
        {
            return ReflectionHelper.InvokeStaticMethod<bool>(FrameworkTypeName, "IsCatchableExceptionType", e);
        }

        public static string GetTypeName(IDataServiceProvider provider, Type type)
        {
            return ReflectionHelper.InvokeStaticMethod<string>(FrameworkTypeName, "GetTypeName", provider.FrameworkObject, type);
        }
    }
}
